<template>
	<el-drawer title="任务详情" v-model="visible" :size="800" destroy-on-close @closed="$emit('closed')">
		<el-container v-loading="loading">
			<el-main>
				<el-form>
					<el-form-item label="任务标题" prop="title">{{form.title}}
					</el-form-item>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="主办人" prop="holder">{{form.holderUserName}}
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="经办人" prop="operator">{{form.operatorUserName}}
							</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="开始时间" prop="beginTime">{{form.beginTime}}
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="结束时间" prop="endTime">{{form.endTime}}
							</el-form-item>
						</el-col>
					</el-row>
					<el-form-item label="任务要求" >
						<div v-html="form.remark"></div>
					</el-form-item>
					<el-form-item label="相关附件" v-if="form.attachId!=''">
						<attach-menu :attachIds="form.attachId" :roleFlag="1" :preview="true"></attach-menu>
					</el-form-item>
					<el-divider content-position="center">处理过程</el-divider>
					<scTable ref="table" :data="tableData" row-key="id" stripe>
						<el-table-column label="#" type="index" width="50"></el-table-column>
						<el-table-column label="处理人" prop="createUser" width="100"></el-table-column>
						<el-table-column label="处理结果" prop="content" width="250" :show-overflow-tooltip="true"></el-table-column>
						<el-table-column label="完成时间" prop="finishTime" width="150"></el-table-column>
						<el-table-column label="进度" prop="progress" width="200">
							<template #default="scope">
								<el-progress :percentage="scope.row.progress*100" />
							</template>
						</el-table-column>
						<el-table-column label="相关附件" prop="attachId" width="250">
							<template #default="scope">
								<attach-menu :attachIds="scope.row.attachId" :roleFlag="1" :preview="true"></attach-menu>
							</template>
						</el-table-column>
					</scTable>
				</el-form>
				<el-footer style="text-align: center;">
					<el-button @click="visible=false">关闭</el-button>
				</el-footer>
			</el-main>
		</el-container>
	</el-drawer>
</template>

<script>
import AttachMenu from '@/views/module/attachMenu'
export default {
	emits: ['success', 'closed'],
	components: {
		AttachMenu
	},
	data() {
		return {
			loading: false,
			tableData:[],
			form: {
				supervisionId:'',
				processId:"",
				title: '',
				holder:"",
				operatorUserName:'',
				beginTime:'',
				endTime:'',
				remark: '',
				attachId:'',
			},
			visible: false,
			isSaveing: false,
		}
	},
	mounted() {

	},
	methods: {
		//显示
		open(){
			this.visible = true;
			return this;
		},
		setData(data){
			this.form.supervisionId = data.supervisionId
			this.form.title = data.title
			this.form.processId = data.processId
			this.form.holderUserName = data.holderUserName
			this.form.operatorUserName = data.operatorUserName
			this.form.beginTime = data.beginTime
			this.form.endTime = data.endTime
			this.form.attachId = data.attachId
			this.form.remark = data.remark
			this.getSupervisionResultList();
		},
		async getSupervisionResultList(){
			var res = await this.$API.supervision.supervisionResult.getSupervisionResultList.get({processId:this.form.processId});
			if (res.code == 200) {
				this.tableData = res.data;
			} else {
				this.$alert(res.message, "提示", {type: 'error'})
			}
		}
	}
}
</script>

<style>
</style>
